package dao

import (
	"github.com/exam/model"
	"gorm.io/gorm"
)

type OrderDao struct {
	db *gorm.DB
}

func (o *OrderDao) Find() ([]model.Order, int64) {

	var order []model.Order
	var count int64
	o.db.Select("id").Where("status = 1").Find(&order).Count(&count)

	return order, count

}

func NewOrderDao(db *gorm.DB) *OrderDao {
	return &OrderDao{
		db: db,
	}
}
